package com.lili.controller.officer;

import com.lili.base.constants.ResponseConstant;
import com.lili.base.vo.ResultAPI;
import com.lili.service.IndexService;
import com.lili.vo.response.officer.IndexVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@PreAuthorize("hasAnyRole('officer')")
@RequestMapping("/officer/dashboard/")
@RestController("officerDashBoardController")
@Api(value = "军官首页的API", tags = "军官首页信息API")
public class DashBoardController {

   private IndexService indexService;

   @Autowired
    public DashBoardController(IndexService indexService) {
        this.indexService = indexService;
    }

    @GetMapping("index")
    @ApiOperation("军官首页信息的查询")
    public ResultAPI<IndexVO> getIndex(){
        IndexVO vo = indexService.getofficerIndex();
        return new ResultAPI<>(ResponseConstant.SUCCESS,"",vo);
    }
}
